import subprocess
import sys
import io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
def check_windows_update():
    cmd = 'powershell.exe Get-WmiObject -Query "Select * from Win32_OperatingSystem"'
    process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
    stdout, stderr = process.communicate()
    if "UpToDate" in stdout.decode():
        return "系统已经是最新版本"
    else:
        return "系统有可用的更新"


print(check_windows_update())
